package com.asset.salesforce.dao;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.stereotype.Repository;

import com.asset.salesforce.domain.SharedLead;

@Repository
public class SharedLeadDaoImpl extends BasicDaoImpl<SharedLead>{

	@SuppressWarnings("unchecked")
	public List<SharedLead>getAllSharedByEmployee(Integer id){
		Session session =sessionFactory.getCurrentSession();
		List<SharedLead> leads = new ArrayList<SharedLead>();
		Query query = session.createQuery("from SharedLead where employee.id=:id");
		query.setParameter("id", id);
		leads = query.list();
		if(leads.size()>0){
			return  leads;
		}
		else{
			return new ArrayList<SharedLead>();
		}
	}
}
